<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>项目流程跟踪页面</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<div class="fieldBox" style="display:none;">
			<input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId}">
		</div>
	</div>
	<div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/product/splInfo/initPorjectFlowList.do?splId=${splId}',
            method : 'get',
            columns: [
                { display: '业务数据编号', name: 'grpFlag', minwidth: 120 , enabledSort:true},
                { display: '流程名称', name: 'pno', minWidth: 180 , align:'center', enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        h='<a href="javascript:commShowFlow(';
                        h+="'"+value+"',";
                        h+="'"+rowdata.pinstId+"',"; //流程实例ID
                        h+="'"+rowdata.audStsCd+"',"; //审核状态
                        h+="'"+rowdata.dataId+"',"; //业务主键ID
                        h+="'"+rowdata.busTyp+"',"; //业务类型
                        h+="'"+rowdata.buOrgCd+"'"; //所属事业部
                        h+=')">'+value+'</a>';
                        return h;
                    }},
                { display: '状态', name: 'audStsCd', minwidth: 120, enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if(rowdata.audStsCd=="0"){
                            h = '待提交';
                        }else if(rowdata.audStsCd=="1"){
                            h = '审核中';
                        }else if(rowdata.audStsCd=="2"){
                            h = '审核通过';
                        }else if(rowdata.audStsCd=="3"){
                            h = '审核不通过';
                        }else if(rowdata.audStsCd=="4"){
							h = '驳回呈报人';
						}
                        return h;
                    }},
                { display: '创建人', name: 'crtUsrName', minwidth: 120 , enabledSort:true},
                { display: '创建时间', name: 'pCrtTm', minWidth: 140 , render:renderDate, enabledSort:false},
            ],
            //pageSize:10,
            usePager:false,
            root:'rows',
            record:'total',
            hideLoadButton : true,
            width: '100%',
            height:'100%',
            heightDiff:-2,
            checkbox:false,
            rownumbers:true,
            onAfterShowData: function ()
            {
                $('#ligergrid1').rowspan('grpFlag');
            }
        });
        grid = liger.get("ligergrid1");
        grid.setHeight(100);
        $("#searchBar").ligerForm();
        $("#searchBtn").click(function(event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            data["crtTm"] = $("#crtTm").val();
            for (name in data){
                grid.setParm(name,data[name]);
            };
            grid.reload();
        });

        $("#pageloading").hide();

    });

    function commShowFlow(value, pinstId, audStsCd, dataId, busTyp, buOrgCd){
        if(StringUtils.isEmpty(pinstId)){
            UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
            return;
        }
        var _formUrl = "";
        var v1 = value.substring(0,11);
        var v2 = value.substring(0,9);
        console.log(value)
        if(busTyp=='003'){//供应商流程
            _formUrl = "/product/splInfo/toDetailPage.do?isFlow=1@@id=";
        }else if(busTyp=='004'){//供应商账号流程
            _formUrl = "/product/splBank/toDetail.do?isFlow=1@@id=";
        }else if(busTyp == '028'){//供应商放款流程权限流程
            _formUrl = "/bizflow/sysBizFlowRl/toDetailPage.do?currBuOrgCd="+buOrgCd+"@@audStsCd="+audStsCd+"@@saveBizFlowRl=0"+"@@saveNoSpNum=0@@tabNm=SPL_BSC_INFO@@codeGrpCd=FLW0001@@processInstanceId="+pinstId+"@@dataId=";
        }else if(busTyp == '029'){//轻卡供应商放款流程权限流程
			_formUrl = "/bizflow/sysBizFlowRl/toDetailPage.do?currBuOrgCd="+buOrgCd+"@@audStsCd="+audStsCd+"@@saveBizFlowRl=0"+"@@saveNoSpNum=0@@tabNm=SPL_BSC_INFO@@codeGrpCd=FLW0001@@processInstanceId="+pinstId+"@@dataId=";
		}else if(busTyp == '030'){//供应商变更流程
            //console.log(va)
            if(v1 == "供应商位置信息变更流程"){
                _formUrl = "/spl/splpositioninfo/toDetailPage.do?audStsCd=1@@id="
            }else if(v2 == "供应商位置信息变更"){
                _formUrl = "/spl/splpositioninfo/toDetailPage.do?audStsCd=1@@id="
            } else{
                _formUrl = "/product/splApplyInfo/toModifyPage.do?audStsCd=1@@applyId=";
            }
        }else if(busTyp == '032'){
            _formUrl = "/spl/splpositioninfo/toDetailPage.do?audStsCd=1@@id="
        }else if(busTyp == '048'){
			//_formUrl = "/product/splInfo/toDetailPage.do?isFlow=1@@isModify=0@@id=";
			_formUrl = "/spl/spepow/toSplDetailPage.do?isSpePow=1@@isModify=0@@isFlow=1@@isApply=1@@id=";
		}else if('077' == busTyp){
			 _formUrl = "/prjsteprebate/steprebateBscInfo/toDetailPage.do?isDetail=1@@id=";
		}
        var params = "?pInsId="+pinstId+"&status="+audStsCd+"&businessKey="+dataId+"&formUrl="+_formUrl+"&id="+dataId;
        Add_navTab('tab_cst_invoice_flow_'+dataId+pinstId,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }

    //格式化时间
    function renderDate(rowdata, index, value){
        var dateStr = "";
        if(null != value){
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }

</script>

</body>
</html>